import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../common/api_service.dart';
import '../model/user_model.dart';

class ProfileController extends GetxController {
  final String uid = Get.arguments['uid'] ?? '';
  Rx<UserModel?> user = Rx<UserModel?>(null);
  RxString userAvatarFrame = ''.obs;
  final scrollController = ScrollController();
  final tabItems = ['内容', '角色'];

  @override
  void onInit() {
    super.onInit();
    _getUserInfo();
  }

  @override
  void onClose() {
    scrollController.dispose();
    super.onClose();
  }

  void _getUserInfo() {
    ApiService().getUserInfo(uid, (userModel) {
      user.value = userModel;
      userAvatarFrame.value = userModel?.setting?.avatarFrame ?? '';
    }, () {});
  }
}
